//package com.lythen.test.geo.es.config;
//
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//import org.elasticsearch.client.RestClient;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.elasticsearch.client.ClientConfiguration;
//import org.springframework.data.elasticsearch.client.RestClients;
//import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration;
//
//import java.time.Duration;
//
///**
// * @author 赖仁良
// * @date 2021/9/29
// */
//@EqualsAndHashCode(callSuper = true)
//@ConfigurationProperties("spring.data.elasticsearch.client")
//@Configuration
//@Data
//public class ElasticSearchClientConfiguration extends AbstractElasticsearchConfiguration {
//	private String[] endpoints;
//	private String username;
//	private String password;
//	private int connectionTimeout;
//	private int socketTimeout;
//
//	/**
//	 * Return the {@link RestHighLevelClient} instance used to connect to the cluster. <br />
//	 *
//	 * @return never {@literal null}.
//	 */
//	@Bean("restHighLevelClient")
//	@Override
//	public RestHighLevelClient elasticsearchClient() {
//		ClientConfiguration clientConfiguration = ClientConfiguration.builder().connectedTo(endpoints)
//				.withConnectTimeout(Duration.ofSeconds(connectionTimeout)).withSocketTimeout(Duration.ofSeconds(socketTimeout))
//				.withBasicAuth(username,password)
//				.build();
//		return RestClients.create(clientConfiguration).rest();
//	}
//
//	@Bean("restLowLevelClient")
//	public RestClient restLowLevelClient() {
//		ClientConfiguration clientConfiguration = ClientConfiguration.builder().connectedTo(endpoints)
//				.withConnectTimeout(Duration.ofSeconds(connectionTimeout)).withSocketTimeout(Duration.ofSeconds(socketTimeout))
//				.withBasicAuth(username,password)
//				.build();
//		return RestClients.create(clientConfiguration).lowLevelRest();
//	}
//}
